<?php
/* @var $this UserController */
/* @var $model User */

?>
<?php if(count($model->getErrors()) > 0):?>
	<div class="alert alert-error">
		<?php echo CHtml::errorSummary($model); ?>
	</div>
<?php endif;?>
<?php echo CHtml::beginForm('', 'post', array('autocomplete'=>'off')); ?>
	<fieldset>
		<legend>Редактирование пользователя</legend>
		<div class="row">
			<div class="span4">
				<div><strong>E-mail:</strong></div>
				<div><?php echo $model['email']?></div>
				<br>
				
				<?php echo CHtml::activeLabelEx($model,'newPassword'); ?>
				<?php echo CHtml::activePasswordField($model,'newPassword'); ?>
				
				<?php echo CHtml::activeLabelEx($model,'newPasswordConfirm'); ?>
				<?php echo CHtml::activePasswordField($model,'newPasswordConfirm'); ?>
				
				
				<?php echo CHtml::activeLabelEx($model,'name'); ?>
				<?php echo CHtml::activeTextField($model,'name'); ?>
				
				<?php echo CHtml::activeLabelEx($model,'lastname'); ?>
				<?php echo CHtml::activeTextField($model,'lastname'); ?>
				
				<?php echo CHtml::activeLabelEx($model,'country'); ?>
				<?php echo CHtml::activeTextField($model,'country'); ?>
				
				<?php echo CHtml::activeLabelEx($model,'city'); ?>
				<?php echo CHtml::activeTextField($model,'city'); ?>
	
				<br>
				<?php echo CHtml::submitButton('Изменить'); ?>
			</div>
			<div class="span1"></div>
			<div class="span4">
				<strong>Роль</strong>
				<?php $roles=Yii::app()->authManager->getRoles();?>
				<input type="hidden" name="Roles"/>
				<?php foreach($roles as $name=>$role):?>
					<label>
						<input type="checkbox" name="Roles[<?php echo $name;?>]" <?php if(Yii::app()->authManager->isAssigned($name, $_GET['id'])):?>checked<?endif;?>>
						<?php $name=$role->getDescription();?>
						<?php echo empty($name) ? $role->getName() : $name;?>
					</label>
				<?php endforeach;?>
			</div>
		</div>
	</fieldset>
<?php echo CHtml::endForm(); ?>